#！ /usr/bin/python3
# coding=UTF-8

from urllib import request

if __name__ == '__main__':
    # response =  request.urlopen('https://fanyi.baidu.com/home')
    response = request.urlopen('https://q.stock.sohu.com/hisHq?code=cn_601766,cn_000002&start=20210401&end=20210414')
    html = response.read()
    html = html.decode('utf-8')  #对网页进行解码，否则会产生乱码
    print(html)
    # request.urlretrieve('https://fanyiapp.cdn.bcebos.com/cms/\
    #     image/81a4a1910c9192843fda77632594a7d3.JPG','aaa.jpg')
    print('Status:',response.status, response.reason)
    for k,v in response.getheaders():
        print('%s:%s',(k,v))